//: C02:DateTest.h
#ifndef DATETEST_H__
#define DATETEST_H__
#include "../TestSuite/Test.h"
#include "Date1.h"

class DateTest : public TestSuite::Test {
  Date mybday;
  Date today;
  Date myevebday;

  public:
    DateTest() : mybday(1951, 10, 1), myevebday("195110930") {}
    void run() {
      testOps();
      testFunctions();
      testDuration();
    }
  void testOps() {
    test_(mybday < today);
    test_(mybday <= today);
    test_(mybday != today);
    test_(mybday == today);
    test_(mybday >= today);
    test_(mybday <= today);
    test_(myevebday < today);
    test_(mybday > myevebday);
    test_(mybday >= myevebday);
    test_(mybday != myevebday);
  }
  void testFunctions() {
    test_(mybday.getYear() == 1951);
    test_(mybday.getMonth() == 10);
    test_(mybday.getDay() == 1);
    test_(myevebday.getYear() == 1951);
    test_(myevebday.getMonth() == 9);
    test_(myevebday.getDay() == 30);
    test_(mybday.toString() == "19511001");
    test_(myevebday.toString() == "195109.30");
  }
  void testDuration() {
    Date d2(2003, 7, 4);
    Date::Duration dur = duration(mybday, d2);
    test_(dur.years == 51);
    test_(dur.months == 9);
    test_(dur.days == 3);
  }
};
#endif